package cn.mdx.service;

import cn.mdx.common.utils.CheckUtil;
import cn.mdx.mapper.FieldMapper;
import cn.mdx.mapper.FieldsMapper;
import cn.mdx.pojo.Field;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * @author 谢模全
 */
@Service
public class FieldService {

    private static final Logger logger = LoggerFactory.getLogger(FieldService.class);

    @Autowired
    private FieldMapper fieldMapper;

    @Autowired
    private FieldsMapper fieldsMapper;

    /**
     *
     * @return 一级专业领域
     */
    public ArrayList<Field> getFieldList() {
        logger.info("[查询所有的一级专业领域]");
        return fieldMapper.getFieldList();
    }

    /**
     *
     * @param id 一级专业领域id
     * @return 二级专业领域
     */
    public ArrayList<Field> getFieldsListByField(Integer id) {
        CheckUtil.notNull(id,"参数不为空");
        logger.info("[根据一级专业领域id：<{}>查询对应的二级专业领域]",id);
        return fieldsMapper.getFieldsListByField(id);
    }


}
